<?php 

head("K&P's");
menue();
?>

	<div id="slideshow">
		<div id="slideshowimages">
        	<?php 
				
				$sql = "SELECT
						g.image_id,
						g.filename,
						d.description,
						d.nav_url
						
					  FROM
						gallery AS g,
						gallery_description AS d
						
						WHERE
						g.image_id = d.image_id
						AND
						d.lang_id = '1'
						
						ORDER BY 
						g.order_number DESC
					";
				$result = query($sql);
				
				while ($row = mysql_fetch_object($result)) {
			?>
            
			<img src="<?=HTML_BASE?>gallery/<?=$row->filename?>" alt="<?=$row->description?>">
           
			
            <?php }?>
		</div>
	</div>
<?php

$sql = "SELECT
			  c.catalog_id,
			  c.sef_url,
			  
			  d.title
			  
		  FROM
			  catalog AS c,
			  catalog_description AS d
		  WHERE
		  
			  c.catalog_id = d.catalog_id
			  
			  AND
			  c.published
			  AND
			  
			  d.lang_id = '1'
			  
			  ORDER BY c.order_number DESC
			";
			$result = query($sql);

?>
		
	<div id="slider">
		<div id="sliderimages">
        <?php while ($row = mysql_fetch_object($result)) { 
			$sql_img = "SELECT image FROM
						catalog_image WHERE catalog_id = '".$row->catalog_id."' ORDER BY top DESC LIMIT 1 "; 
						
						$resimg = query($sql_img);
						$rimg = mysql_fetch_object($resimg);
						$dr = HTML_BASE."catalogimage/".$row->catalog_id."/";
						
			?>
                <a href="<?=HTML_BASE?>product/<?=$row->sef_url?>/">
                        <img src="<?=$dr?>th_<?=$rimg->image?>" alt="<?=$row->title?>">
                        <span><?=$row->title?></span>
                </a>
			<?php }?>
		</div>
		
		<a class="arrow-left" href="#"></a>
		<a class="arrow-right" href="#"></a>
		
	</div>

    

<?php foot(); ?>
<script src="<?=HTML_BASE?>js/homepage.js" type="text/javascript"></script>
</body>
</html>